package org.jdarwinbots.logic;

import java.util.Stack;

public abstract class Operator {
	public abstract void execute(int[] memory, Stack<Integer> intstack, Stack<Boolean> boolstack);
	
	protected boolean peekBool(Stack<Boolean> boolstack){
		if(boolstack.isEmpty()) return true;
		else return boolstack.peek();
	}
	
	protected int peekInt(Stack<Integer> intstack){
		if(intstack.isEmpty()) return 0;
		else return intstack.peek();
	}
	
	protected int getNextInt(Stack<Integer> intstack){
		if(intstack.isEmpty()) return 0;
		else return intstack.pop();
	}
	
	protected boolean getNextBool(Stack<Boolean> boolstack){
		if(boolstack.isEmpty()) return true;
		else return boolstack.pop();
	}
}
